package com.qfmy.mystation.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;

import com.qfmy.mystation.R;
import com.qfmy.mystation.databinding.FragmentHomeBinding;
import com.qfmy.mystation.ui.activity.WallpaperActivity;

public class HomeFragment extends Fragment {

    private FragmentHomeBinding binding;

    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        binding = FragmentHomeBinding.inflate(inflater, container, false);
        binding.ivWallpaper.setOnClickListener(view -> {
            startActivity(new Intent(getActivity(), WallpaperActivity.class));
        });

        binding.ivBlog.setOnClickListener(view -> {
            Navigation.findNavController(view).navigate(R.id.action_nav_home_to_nav_blog);
        });

        binding.ivMusic.setOnClickListener(view -> {
            Navigation.findNavController(view).navigate(R.id.action_nav_home_to_nav_music);
        });
        return binding.getRoot();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binding = null;
    }
}